package com.sylar.happygps;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class TourEditActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.touredit);

		Button btn_title_left = (Button) findViewById(R.id.btn_title_left);
		btn_title_left.setText(R.string.app_name);
		btn_title_left.setVisibility(View.VISIBLE);
		btn_title_left.setOnClickListener(this);

		TextView tv_title_name = (TextView) findViewById(R.id.tv_title_name);
		tv_title_name.setText("编辑景点介绍");
		tv_title_name.setVisibility(View.VISIBLE);

		View btn_help = (TextView) findViewById(R.id.btn_help);
		btn_help.setVisibility(View.VISIBLE);
		btn_help.setOnClickListener(this);
		
		View layout_scope = findViewById(R.id.layout_scope);
		layout_scope.setOnClickListener(this);
		View layout_seen1 = findViewById(R.id.layout_seen1);
		layout_seen1.setOnClickListener(this);
		View layout_seen2 = findViewById(R.id.layout_seen2);
		layout_seen2.setOnClickListener(this);
		View layout_addpic = findViewById(R.id.layout_addpic);
		layout_addpic.setOnClickListener(this);
		View layout_touetype = findViewById(R.id.layout_touetype);
		layout_touetype.setOnClickListener(this);
		
	}

	
	private void toAddPic(){
		Intent intent = new Intent(this,AddTourPicActivity.class);
		startActivity(intent);
	}
	
	private void showTourType(){
		new AlertDialog.Builder(this)
		.setItems(new String[]{"自然景观","人文景观","参观展览","旅行服务","景点出入口","景点入口","景点出口","卫生间","餐饮","住宿","购物","交通出行","娱乐健身","未分类"},
			new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		})
		.setTitle("选择道路类型")
		.create().show();
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.layout_scope:
			startActivity(new Intent(this,TourSoundEditActivity.class));
			break;
		case R.id.layout_seen1:
			startActivity(new Intent(this,TourNavEditActivity.class));
			break;
		case R.id.layout_seen2:
			startActivity(new Intent(this,TourNavEditActivity.class));
			break;
		case R.id.layout_addpic:
			toAddPic();
			break;
		case R.id.layout_touetype:
			showTourType();
			break;
		case R.id.btn_title_left:
			finish();
			break;
		default:
			break;
		}
	}
}
